home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 54.zip / BS part 54 / FinalCopy2Upd_d4.adf / SampleMacros / CopyObject < prev    next >
Encoding:
Text File  |  1992-10-26  |  2.2 KB  |  89 lines

  1. /* ---------------------------------------------------    */
  2. /* Final Copy II Arexx Macro - OBJECT COPY            */
  3. /* This macro will make a copy of the current selected    */
  4. /* object (except ILBMs).                        */
  5. /* ---------------------------------------------------    */
  6. Options Results
  7.  
  8. /* ------------------------------------    */
  9. /* Set parameters to be in ruler units.    */
  10. /* ------------------------------------    */
  11. SetMeasure Ruler
  12.  
  13. /* -----------------------------------------    */
  14. /* These are the offsets for the new object    */
  15. /* in inches. (.5 = 1/2 inch).            */
  16. /* -----------------------------------------    */ 
  17. XOffset    = .5
  18. YOffset    = .5
  19.  
  20. /* ------------------------------------    */
  21. /* Get the Id of the current object.    */
  22. /* If there is no current object then    */
  23. /* exit the macro.                    */
  24. /* ------------------------------------    */
  25. CurrentObject
  26. objectId = Result
  27. IF    (objectId = 0) THEN
  28.     EXIT
  29.  
  30. /* ------------------------------------    */
  31. /* Find out the type of the object.    */
  32. /* We don't want to copy an ILBM.        */
  33. /* ------------------------------------    */
  34. GetObjectType objectId
  35. type = Result
  36. IF    (type ~= 1) THEN
  37.     DO
  38.  
  39.     /* ------------------------------------    */
  40.     /* Get the coordinates and parameters    */
  41.     /* for the selected object.            */
  42.     /* ------------------------------------    */
  43.     GetObjectCoords objectId
  44.     coords = Result
  45.     GetObjectParams objectId
  46.     params = Result
  47.  
  48.     page    = Word(coords, 1)
  49.     IF    (type = 2 | type = 3) THEN
  50.         DO
  51.         x1        = Word(coords, 2) + XOffset
  52.         y1        = Word(coords, 3) + YOffset
  53.         x2        = Word(coords, 4) + XOffset
  54.         y2        = Word(coords, 5) + YOffset
  55.         END
  56.     ELSE
  57.         DO
  58.         left        = Word(coords, 2) + XOffset
  59.         top        = Word(coords, 3) + YOffset
  60.         width    = Word(coords, 4)
  61.         height    = Word(coords, 5)
  62.         END
  63.  
  64.     modifier = ""
  65.     IF    (type = 3) THEN
  66.         modifier = "ARROW"
  67.     ELSE    IF (type = 5) THEN
  68.         modifier = "BEVEL"
  69.  
  70.     IF    (type = 2 | type = 3) THEN
  71.         DrawLine page x1 y1 x2 y2 modifier
  72.     ELSE IF (type = 4 | type = 5) THEN
  73.         DrawBox page left top width height modifier
  74.     ELSE
  75.         DrawOval page left top width height
  76.  
  77.     newObjectId = Result
  78.  
  79.     /* -------------------------------    */
  80.     /* Now Set the object parameters.    */
  81.     /* -------------------------------    */
  82.     SetObjectParams newObjectId params
  83.  
  84.     /* -------------------------------    */
  85.     /* Draw the new object.            */
  86.     /* -------------------------------    */
  87.     Redraw
  88.     END
  89.